package service.impl;




import dao.PhoneDAO;
import dao.impl.PhoneImpl;
import entity.Phone;
import service.PhoneService;

import java.sql.SQLException;
import java.util.List;

/**
 * PetService的实现
 */
public class PhoneServiceImpl implements PhoneService {
    private PhoneDAO phoneDao = new PhoneImpl();

    @Override
    public List<Phone> findAllPhones() throws SQLException {
        return phoneDao.selectAllPhones();
    }

    @Override
    public void addPhone(Phone phone) throws SQLException {
        phoneDao.insertPhone(phone);
    }

    @Override
    public void modifyPhoneById(Phone phone) throws SQLException {
        phoneDao.updatePhoneById(phone);
    }

    @Override
    public Phone findPhoneById(int id) throws SQLException {
        return phoneDao.selectPhoneById(id);
    }

    @Override
    public void removePhoneById(int id) throws SQLException {
        phoneDao.deletePhoneById(id);
    }
}
